/*     */ package com.umeng.common.net;
/*     */ 
/*     */ import android.app.Notification;
/*     */ import android.app.NotificationManager;
/*     */ import android.app.PendingIntent;
/*     */ import android.app.Service;
/*     */ import android.content.BroadcastReceiver;
/*     */ import android.content.Context;
/*     */ import android.content.Intent;
/*     */ import android.content.IntentFilter;
/*     */ import android.os.Bundle;
/*     */ import android.os.DeadObjectException;
/*     */ import android.os.Debug;
/*     */ import android.os.Handler;
/*     */ import android.os.IBinder;
/*     */ import android.os.Message;
/*     */ import android.os.Messenger;
/*     */ import android.os.RemoteException;
/*     */ import android.util.SparseArray;
/*     */ import android.widget.Toast;
/*     */ import com.umeng.common.Log;
/*     */ import com.umeng.common.b;
/*     */ import java.io.File;
/*     */ import java.io.FileOutputStream;
/*     */ import java.io.IOException;
/*     */ import java.io.InputStream;
/*     */ import java.net.HttpURLConnection;
/*     */ import java.net.URL;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class DownloadingService extends Service
/*     */ {
/* 104 */   private static final String q = DownloadingService.class.getName();
/*     */   private NotificationManager r;
/* 107 */   private d s = new d();
/*     */   static final int a = 1;
/*     */   static final int b = 2;
/*     */   static final int c = 3;
/*     */   static final int d = 4;
/*     */   static final int e = 5;
/*     */   static final int f = 6;
/*     */   public static final int g = 0;
/*     */   public static final int h = 1;
/*     */   public static final int i = 2;
/*     */   public static final int j = 3;
/*     */   public static final int k = 4;
/*     */   private static final long t = 104857600L;
/*     */   private static final long u = 10485760L;
/*     */   private static final long v = 259200000L;
/*     */   static final int l = 100;
/*     */   static final String m = "filename";
/*     */   private static final int w = 3;
/*     */   private Context x;
/*     */   private Handler y;
/*     */   a n;
/* 147 */   public static boolean o = false;
/*     */   private static final long z = 8000L;
/* 153 */   private static Map<a.a, Messenger> A = new HashMap();
/*     */ 
/* 156 */   private static SparseArray<d.a> B = new SparseArray();
/*     */ 
/* 158 */   final Messenger p = new Messenger(new c());
/*     */   private BroadcastReceiver C;
/* 887 */   private static Boolean D = Boolean.valueOf(false);
/*     */ 
/*     */   public IBinder onBind(Intent paramIntent)
/*     */   {
/* 243 */     Log.c(q, "onBind ");
/* 244 */     return this.p.getBinder();
/*     */   }
/*     */ 
/*     */   public void onStart(Intent paramIntent, int paramInt)
/*     */   {
/* 250 */     Log.c(q, "onStart ");
/* 251 */     this.s.a(this, B, A, paramIntent);
/* 252 */     super.onStart(paramIntent, paramInt);
/*     */   }
/*     */ 
/*     */   public void onCreate()
/*     */   {
/* 257 */     super.onCreate();
/*     */ 
/* 259 */     if (o) {
/* 260 */       Log.LOG = true;
/* 261 */       Debug.waitForDebugger();
/*     */     }
/* 263 */     Log.c(q, "onCreate ");
/* 264 */     this.r = ((NotificationManager)getSystemService("notification"));
/* 265 */     this.x = this;
/*     */ 
/* 267 */     this.y = new f(this);
/*     */ 
/* 354 */     this.n = new g(this);
/*     */   }
/*     */ 
/*     */   private void d()
/*     */   {
/* 478 */     IntentFilter localIntentFilter = new IntentFilter("com.umeng.intent.DOWNLOAD");
/* 479 */     this.C = new h(this);
/*     */ 
/* 487 */     registerReceiver(this.C, localIntentFilter);
/*     */   }
/*     */ 
/*     */   private void a(a.a parama) {
/* 491 */     Log.c(q, "startDownload([mComponentName:" + parama.a + " mTitle:" + 
/* 492 */       parama.b + " mUrl:" + parama.c + "])");
/*     */ 
/* 494 */     int i1 = this.s.a(parama);
/* 495 */     b localb = new b(getApplicationContext(), parama, i1, 0, 
/* 496 */       this.n);
/*     */ 
/* 498 */     d.a locala1 = new d.a(parama, i1);
/* 499 */     locala1.a(B);
/* 500 */     locala1.a = localb;
/*     */ 
/* 502 */     localb.start();
/*     */ 
/* 504 */     e();
/* 505 */     if (o)
/* 506 */       for (int i2 = 0; i2 < B.size(); i2++) {
/* 507 */         d.a locala2 = (d.a)B.valueAt(i2);
/* 508 */         Log.c(q, "Running task " + locala2.e.b);
/*     */       }
/*     */   }
/*     */ 
/*     */   private void a(String paramString)
/*     */   {
/* 890 */     synchronized (D) {
/* 891 */       if (!D.booleanValue()) {
/* 892 */         Log.c(q, "show single toast.[" + paramString + "]");
/* 893 */         D = Boolean.valueOf(true);
/* 894 */         this.y.post(new i(this, paramString));
/*     */ 
/* 900 */         this.y.postDelayed(new j(this), 
/* 905 */           1200L);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public void onDestroy()
/*     */   {
/*     */     try {
/* 913 */       int i1 = 259200;
/* 914 */       c.a(getApplicationContext()).a(i1);
/* 915 */       c.a(getApplicationContext()).finalize();
/* 916 */       if (this.C != null) unregisterReceiver(this.C); 
/*     */     }
/* 918 */     catch (Exception localException) { Log.b(q, localException.getMessage()); }
/*     */ 
/* 920 */     super.onDestroy();
/*     */   }
/*     */ 
/*     */   private void e()
/*     */   {
/* 925 */     if (o) {
/* 926 */       int i1 = A.size();
/* 927 */       int i2 = B.size();
/* 928 */       Log.a(q, "Client size =" + i1 + "   cacheSize = " + i2);
/* 929 */       if (i1 != i2)
/* 930 */         throw new RuntimeException("Client size =" + i1 + "   cacheSize = " + i2);
/*     */     }
/*     */   }
/*     */ 
/*     */   static abstract interface a
/*     */   {
/*     */     public abstract void a(int paramInt);
/*     */ 
/*     */     public abstract void a(int paramInt1, int paramInt2);
/*     */ 
/*     */     public abstract void a(int paramInt, String paramString);
/*     */ 
/*     */     public abstract void a(int paramInt, Exception paramException);
/*     */   }
/*     */ 
/*     */   class b extends Thread
/*     */   {
/*     */     private Context b;
/*     */     private boolean c;
/*     */     private File d;
/* 527 */     private int e = 0;
/* 528 */     private long f = -1L;
/* 529 */     private long g = -1L;
/* 530 */     private int h = -1;
/*     */     private int i;
/*     */     private DownloadingService.a j;
/*     */     private a.a k;
/*     */ 
/*     */     public b(Context parama, a.a paramInt1, int paramInt2, int parama1, DownloadingService.a arg6)
/*     */     {
/*     */       try
/*     */       {
/* 540 */         this.b = parama;
/* 541 */         this.k = paramInt1;
/* 542 */         this.e = parama1;
/*     */ 
/* 544 */         if (DownloadingService.c().indexOfKey(paramInt2) >= 0) {
/* 545 */           d.a locala = (d.a)DownloadingService.c().get(paramInt2);
/* 546 */           long[] arrayOfLong = locala.f;
/* 547 */           if ((arrayOfLong != null) && (arrayOfLong.length > 1)) {
/* 548 */             this.f = arrayOfLong[0];
/* 549 */             this.g = arrayOfLong[1];
/*     */           }
/*     */         }
/*     */         Object localObject;
/* 553 */         this.j = localObject;
/* 554 */         this.i = paramInt2;
/*     */ 
/* 556 */         boolean[] arrayOfBoolean = new boolean[1];
/* 557 */         this.d = q.a("/apk", parama, arrayOfBoolean);
/* 558 */         this.c = arrayOfBoolean[0];
/* 559 */         long l = this.c ? 104857600L : 10485760L;
/* 560 */         q.a(this.d, l, 259200000L);
/* 561 */         String str = a(this.k);
/* 562 */         this.d = new File(this.d, str);
/*     */       }
/*     */       catch (Exception localException)
/*     */       {
/* 566 */         Log.c(DownloadingService.a(), localException.getMessage(), localException);
/* 567 */         this.j.a(this.i, localException);
/*     */       }
/*     */     }
/*     */ 
/*     */     public void run() {
/* 572 */       this.e = 0;
/*     */       try
/*     */       {
/* 576 */         if (this.j != null) this.j.a(this.i);
/* 577 */         a(this.f > 0L);
/*     */ 
/* 580 */         if (DownloadingService.b().size() <= 0)
/* 581 */           DownloadingService.this.stopSelf();
/*     */       }
/*     */       catch (Exception localException) {
/* 584 */         localException.printStackTrace();
/*     */       }
/*     */     }
/*     */ 
/*     */     public void a(int paramInt)
/*     */     {
/* 596 */       this.h = paramInt;
/*     */     }
/*     */ 
/*     */     private void a(boolean paramBoolean)
/*     */     {
/* 602 */       String str = this.d.getName();
/* 603 */       InputStream localInputStream = null;
/* 604 */       FileOutputStream localFileOutputStream = null;
/*     */ 
/* 606 */       label1452: 
/*     */       try { localFileOutputStream = new FileOutputStream(this.d, true);
/* 607 */         if (!this.c)
/*     */         {
/* 610 */           if (!q.a(
/* 609 */             this.d.getAbsolutePath(), 3))
/*     */           {
/* 611 */             localFileOutputStream.close();
/* 612 */             localFileOutputStream = this.b.openFileOutput(str, 
/* 613 */               32771);
/*     */ 
/* 616 */             this.d = this.b.getFileStreamPath(str);
/*     */           }
/*     */         }
/* 619 */         Log.c(DownloadingService.a(), String.format("saveAPK: url = %1$15s\t|\tfilename = %2$15s", new Object[] { 
/* 620 */           this.k.c, this.d.getAbsolutePath() }));
/*     */ 
/* 622 */         URL localURL = new URL(this.k.c);
/* 623 */         HttpURLConnection localHttpURLConnection = a(localURL, this.d);
/* 624 */         localHttpURLConnection.connect();
/* 625 */         localInputStream = localHttpURLConnection.getInputStream();
/*     */ 
/* 627 */         if (!paramBoolean) {
/* 628 */           this.f = 0L;
/* 629 */           this.g = localHttpURLConnection.getContentLength();
/* 630 */           Log.c(DownloadingService.a(), String.format("getContentLength: %1$15s", new Object[] { Long.valueOf(this.g) }));
/*     */         }
/*     */ 
/* 633 */         byte[] arrayOfByte = new byte[4096];
/* 634 */         int m = 0; int n = 0;
/* 635 */         int i1 = 50;
/* 636 */         int i2 = 1;
/*     */ 
/* 638 */         Log.c(DownloadingService.a(), 
/* 639 */           this.k.b + "saveAPK getContentLength " + 
/* 640 */           String.valueOf(this.g));
/*     */ 
/* 642 */         c.a(this.b).a(this.k.a, 
/* 643 */           this.k.c);
/*     */ 
/* 645 */         while ((this.h < 0) && ((n = localInputStream.read(arrayOfByte)) > 0)) {
/* 646 */           localFileOutputStream.write(arrayOfByte, 0, n);
/* 647 */           this.f += n;
/* 648 */           if (m++ % i1 == 0) {
/* 649 */             if (!b.n(this.b)) {
/* 650 */               i2 = 0;
/* 651 */               break;
/*     */             }
/*     */ 
/* 654 */             int i3 = (int)((float)this.f * 100.0F / (float)this.g);
/* 655 */             if (i3 > 100) i3 = 99;
/*     */ 
/* 657 */             if (this.j != null) this.j.a(this.i, i3);
/*     */ 
/* 659 */             b(i3);
/*     */ 
/* 661 */             c.a(this.b).a(
/* 662 */               this.k.a, this.k.c, i3);
/*     */           }
/*     */         }
/* 665 */         localInputStream.close();
/* 666 */         localFileOutputStream.close();
/*     */         Object localObject2;
/* 668 */         if (this.h == 1)
/*     */         {
/* 670 */           localObject2 = (d.a)DownloadingService.c().get(this.i);
/* 671 */           ((d.a)localObject2).f[0] = this.f;
/* 672 */           ((d.a)localObject2).f[1] = this.g;
/* 673 */           ((d.a)localObject2).f[2] = this.e;
/* 674 */           return;
/* 675 */         }if (this.h == 2)
/*     */         {
/* 677 */           DownloadingService.a(DownloadingService.this).a(this.k, this.f, this.g, this.e);
/* 678 */           DownloadingService.c(DownloadingService.this).cancel(this.i);
/* 679 */           return;
/*     */         }
/*     */ 
/* 682 */         if (i2 == 0) {
/* 683 */           Log.b(DownloadingService.a(), "Download Fail repeat count=" + this.e);
/* 684 */           ((Messenger)DownloadingService.b().get(this.k)).send(
/* 685 */             Message.obtain(null, 5, 0, 0));
/* 686 */           DownloadingService.a(DownloadingService.this).a(this.b, DownloadingService.c(), DownloadingService.b(), this.i);
/* 687 */           if (this.j != null) { this.j.a(this.i, null);
/* 688 */             break label1452; }
/*     */         } else {
/* 690 */           b();
/*     */ 
/* 692 */           localObject2 = new File(this.d.getParent(), this.d.getName().replace(".tmp", ""));
/* 693 */           this.d.renameTo((File)localObject2);
/* 694 */           str = ((File)localObject2).getAbsolutePath();
/* 695 */           a((File)localObject2, str);
/*     */ 
/* 697 */           if (this.j != null) this.j.a(this.i, str); 
/*     */         } } catch (IOException localIOException1)
/*     */       {
/* 700 */         Log.c(DownloadingService.a(), localIOException1.getMessage(), localIOException1);
/* 701 */         if ((++this.e > 3) && (!this.k.g)) {
/*     */           try {
/* 703 */             Log.b(DownloadingService.a(), "Download Fail out of max repeat count");
/* 704 */             ((Messenger)DownloadingService.b().get(this.k)).send(
/* 705 */               Message.obtain(null, 5, 0, 0));
/*     */           } catch (RemoteException localRemoteException2) {
/* 707 */             localRemoteException2.printStackTrace();
/*     */           } finally {
/* 709 */             DownloadingService.a(DownloadingService.this).a(this.b, DownloadingService.c(), DownloadingService.b(), this.i);
/* 710 */             a(localIOException1);
/* 711 */             DownloadingService.d(DownloadingService.this).post(new k(this));
/*     */           }
/*     */ 
/*     */         }
/*     */         else
/*     */         {
/* 722 */           a();
/*     */         }
/*     */ 
/*     */         try
/*     */         {
/* 729 */           if (localInputStream != null) localInputStream.close(); 
/*     */         }
/* 731 */         catch (IOException localIOException4) { localIOException4.printStackTrace();
/*     */           try
/*     */           {
/* 734 */             if (localFileOutputStream == null) return; localFileOutputStream.close();
/*     */           } catch (IOException localIOException14) {
/* 736 */             localIOException14.printStackTrace();
/*     */           }
/*     */         }
/*     */         finally
/*     */         {
/*     */           try
/*     */           {
/* 734 */             if (localFileOutputStream != null) localFileOutputStream.close(); 
/*     */           }
/* 736 */           catch (IOException localIOException15) { localIOException15.printStackTrace(); }
/*     */ 
/*     */         }
/*     */         try
/*     */         {
/* 734 */           if (localFileOutputStream != null) localFileOutputStream.close(); 
/*     */         }
/* 736 */         catch (IOException localIOException16) { localIOException16.printStackTrace(); }
/*     */ 
/*     */       }
/*     */       catch (RemoteException localRemoteException1)
/*     */       {
/* 725 */         DownloadingService.a(DownloadingService.this).a(this.b, DownloadingService.c(), DownloadingService.b(), this.i);
/* 726 */         localRemoteException1.printStackTrace();
/*     */         try
/*     */         {
/* 729 */           if (localInputStream != null) localInputStream.close(); 
/*     */         }
/* 731 */         catch (IOException localIOException5) { localIOException5.printStackTrace();
/*     */           try
/*     */           {
/* 734 */             if (localFileOutputStream == null) return; localFileOutputStream.close();
/*     */           } catch (IOException localIOException17) {
/* 736 */             localIOException17.printStackTrace();
/*     */           }
/*     */         }
/*     */         finally
/*     */         {
/*     */           try
/*     */           {
/* 734 */             if (localFileOutputStream != null) localFileOutputStream.close(); 
/*     */           }
/* 736 */           catch (IOException localIOException18) { localIOException18.printStackTrace(); }
/*     */ 
/*     */         }
/*     */         try
/*     */         {
/* 734 */           if (localFileOutputStream != null) localFileOutputStream.close(); 
/*     */         }
/* 736 */         catch (IOException localIOException19) { localIOException19.printStackTrace(); }
/*     */ 
/*     */       }
/*     */       finally
/*     */       {
/*     */         try
/*     */         {
/* 729 */           if (localInputStream != null) localInputStream.close(); 
/*     */         }
/* 731 */         catch (IOException localIOException6) { localIOException6.printStackTrace();
/*     */           try
/*     */           {
/* 734 */             if (localFileOutputStream != null) localFileOutputStream.close(); 
/*     */           }
/* 736 */           catch (IOException localIOException20) { localIOException20.printStackTrace(); }
/*     */ 
/*     */         }
/*     */         finally
/*     */         {
/*     */           try
/*     */           {
/* 734 */             if (localFileOutputStream != null) localFileOutputStream.close(); 
/*     */           }
/* 736 */           catch (IOException localIOException21) { localIOException21.printStackTrace(); }
/*     */ 
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/*     */     private void a()
/*     */     {
/* 744 */       Log.c(DownloadingService.a(), "wait for repeating Test network repeat count=" + this.e);
/*     */       try {
/* 746 */         if (!this.k.g) {
/* 747 */           Thread.sleep(8000L);
/* 748 */           if (this.g < 1L) a(false);
/*     */           else
/* 750 */             a(true);
/*     */         }
/*     */         else {
/* 753 */           d.a locala = (d.a)DownloadingService.c().get(this.i);
/* 754 */           locala.f[0] = this.f;
/* 755 */           locala.f[1] = this.g;
/* 756 */           locala.f[2] = this.e;
/*     */ 
/* 759 */           String str = m.a(this.i, 
/* 760 */             "continue");
/* 761 */           Intent localIntent = new Intent(this.b, DownloadingService.class);
/* 762 */           localIntent.putExtra("com.umeng.broadcast.download.msg", str);
/* 763 */           DownloadingService.a(DownloadingService.this).a(DownloadingService.this, DownloadingService.c(), DownloadingService.b(), localIntent);
/*     */ 
/* 765 */           DownloadingService.a(DownloadingService.this, this.b.getString(com.umeng.common.a.c.c(this.b)));
/* 766 */           Log.c(DownloadingService.a(), "changed play state button on op-notification.");
/*     */         }
/*     */       } catch (InterruptedException localInterruptedException) {
/* 769 */         a(localInterruptedException);
/* 770 */         DownloadingService.a(DownloadingService.this).a(this.b, DownloadingService.c(), DownloadingService.b(), this.i);
/*     */       }
/*     */     }
/*     */ 
/*     */     private void b(int paramInt) throws RemoteException
/*     */     {
/*     */       try {
/* 777 */         if (DownloadingService.b().get(this.k) != null)
/* 778 */           ((Messenger)DownloadingService.b().get(this.k)).send(
/* 779 */             Message.obtain(null, 3, paramInt, 0));
/*     */       }
/*     */       catch (DeadObjectException localDeadObjectException) {
/* 782 */         Log.b(DownloadingService.a(), 
/* 783 */           String.format(
/* 784 */           "Service Client for downloading %1$15s is dead. Removing messenger from the service", new Object[] { 
/* 785 */           this.k.b }));
/* 786 */         DownloadingService.b().put(this.k, null);
/*     */       }
/*     */     }
/*     */ 
/*     */     private HttpURLConnection a(URL paramURL, File paramFile) throws IOException {
/* 791 */       HttpURLConnection localHttpURLConnection = (HttpURLConnection)paramURL.openConnection();
/* 792 */       localHttpURLConnection.setRequestMethod("GET");
/* 793 */       localHttpURLConnection.setRequestProperty("Accept-Encoding", "identity");
/* 794 */       localHttpURLConnection.addRequestProperty("Connection", "keep-alive");
/* 795 */       localHttpURLConnection.setConnectTimeout(5000);
/* 796 */       localHttpURLConnection.setReadTimeout(10000);
/* 797 */       if ((paramFile.exists()) && (paramFile.length() > 0L))
/*     */       {
/* 799 */         localHttpURLConnection.setRequestProperty("Range", "bytes=" + paramFile.length() + "-");
/*     */       }
/* 801 */       return localHttpURLConnection;
/*     */     }
/*     */ 
/*     */     private String a(a.a parama)
/*     */     {
/*     */       String str;
/* 806 */       if (this.k.e != null)
/* 807 */         str = this.k.e + ".apk.tmp";
/*     */       else {
/* 809 */         str = com.umeng.common.util.h.a(this.k.c) + ".apk.tmp";
/*     */       }
/* 811 */       if (this.k.a.equalsIgnoreCase("delta_update")) {
/* 812 */         str = str.replace(".apk", ".patch");
/*     */       }
/* 814 */       return str;
/*     */     }
/*     */ 
/*     */     private void b()
/*     */     {
/* 819 */       if (this.k.f != null) {
/* 820 */         HashMap localHashMap = new HashMap();
/* 821 */         localHashMap.put("dsize", String.valueOf(this.g));
/*     */ 
/* 823 */         String str1 = com.umeng.common.util.h.a();
/*     */ 
/* 825 */         String str2 = str1.split(" ")[1];
/* 826 */         localHashMap.put("dtime", str2);
/*     */ 
/* 828 */         localHashMap.put("ptimes", String.valueOf(this.e));
/*     */ 
/* 830 */         DownloadingService.a(DownloadingService.this).a(localHashMap, true, 
/* 831 */           this.k.f);
/*     */       }
/*     */     }
/*     */ 
/*     */     private void a(File paramFile, String paramString)
/*     */       throws RemoteException
/*     */     {
/* 838 */       if ((this.k.d != null) && (!this.k.d.equalsIgnoreCase(com.umeng.common.util.h.a(paramFile)))) {
/* 839 */         if (this.k.a.equalsIgnoreCase("delta_update")) {
/* 840 */           DownloadingService.c(DownloadingService.this).cancel(this.i);
/* 841 */           localObject1 = new Bundle();
/* 842 */           ((Bundle)localObject1).putString("filename", paramString);
/*     */ 
/* 844 */           localObject2 = Message.obtain();
/* 845 */           ((Message)localObject2).what = 5;
/* 846 */           ((Message)localObject2).arg1 = 3;
/* 847 */           ((Message)localObject2).arg2 = this.i;
/* 848 */           ((Message)localObject2).setData((Bundle)localObject1);
/*     */           try
/*     */           {
/* 851 */             if (DownloadingService.b().get(this.k) != null) {
/* 852 */               ((Messenger)DownloadingService.b().get(this.k)).send((Message)localObject2);
/*     */             }
/* 854 */             DownloadingService.a(DownloadingService.this).a(this.b, DownloadingService.c(), DownloadingService.b(), this.i);
/*     */           } catch (RemoteException localRemoteException) {
/* 856 */             DownloadingService.a(DownloadingService.this).a(this.b, DownloadingService.c(), DownloadingService.b(), this.i);
/*     */           }
/* 858 */           return;
/*     */         }
/* 860 */         ((Messenger)DownloadingService.b().get(this.k)).send(
/* 861 */           Message.obtain(null, 5, 0, 0));
/* 862 */         DownloadingService.a(DownloadingService.this).a(this.b, DownloadingService.c(), DownloadingService.b(), this.i);
/* 863 */         Object localObject1 = new Notification(
/* 864 */           17301634, 
/* 865 */           this.b.getString(com.umeng.common.a.c.h(this.b)), 
/* 866 */           System.currentTimeMillis());
/*     */ 
/* 868 */         Object localObject2 = PendingIntent.getActivity(
/* 869 */           this.b, 0, new Intent(), 0);
/* 870 */         ((Notification)localObject1).setLatestEventInfo(this.b, 
/* 871 */           b.w(this.b), 
/* 872 */           this.k.b + this.b.getString(com.umeng.common.a.c.h(this.b)), (PendingIntent)localObject2);
/* 873 */         localObject1.flags |= 16;
/* 874 */         DownloadingService.c(DownloadingService.this).notify(this.i, (Notification)localObject1);
/*     */       }
/*     */     }
/*     */ 
/*     */     private void a(Exception paramException) {
/* 879 */       Log.b(DownloadingService.a(), "can not install. " + paramException.getMessage());
/* 880 */       if (this.j != null) this.j.a(this.i, paramException);
/*     */ 
/* 883 */       DownloadingService.a(DownloadingService.this).a(this.k, this.f, this.g, this.e);
/*     */     }
/*     */   }
/*     */ 
/*     */   class c extends Handler
/*     */   {
/*     */     c()
/*     */     {
/*     */     }
/*     */ 
/*     */     public void handleMessage(Message paramMessage)
/*     */     {
/* 179 */       Log.c(DownloadingService.a(), "IncomingHandler(msg.what:" + paramMessage.what + " msg.arg1:" + paramMessage.arg1 + 
/* 180 */         " msg.arg2:" + paramMessage.arg2 + " msg.replyTo:" + paramMessage.replyTo);
/* 181 */       switch (paramMessage.what) {
/*     */       case 4:
/* 183 */         Bundle localBundle = paramMessage.getData();
/* 184 */         Log.c(DownloadingService.a(), "IncomingHandler(msg.getData():" + localBundle);
/* 185 */         a.a locala = a.a.a(localBundle);
/*     */         Message localMessage;
/* 186 */         if (DownloadingService.a(DownloadingService.this).a(locala, DownloadingService.o, DownloadingService.b(), paramMessage.replyTo)) {
/* 187 */           Log.a(DownloadingService.a(), locala.b + " is already in downloading list. ");
/* 188 */           Toast.makeText(DownloadingService.b(DownloadingService.this), 
/* 189 */             com.umeng.common.a.c.b(DownloadingService.b(DownloadingService.this)), 
/* 190 */             0).show();
/* 191 */           localMessage = Message.obtain();
/* 192 */           localMessage.what = 2;
/* 193 */           localMessage.arg1 = 2;
/* 194 */           localMessage.arg2 = 0;
/*     */           try {
/* 196 */             paramMessage.replyTo.send(localMessage);
/*     */           } catch (RemoteException localRemoteException1) {
/* 198 */             localRemoteException1.printStackTrace();
/*     */           }
/* 200 */           return;
/*     */         }
/* 202 */         if (b.n(DownloadingService.this.getApplicationContext())) {
/* 203 */           DownloadingService.b().put(locala, paramMessage.replyTo);
/* 204 */           localMessage = Message.obtain();
/* 205 */           localMessage.what = 1;
/* 206 */           localMessage.arg1 = 1;
/* 207 */           localMessage.arg2 = 0;
/*     */           try {
/* 209 */             paramMessage.replyTo.send(localMessage);
/*     */           }
/*     */           catch (RemoteException localRemoteException2) {
/* 212 */             localRemoteException2.printStackTrace();
/*     */           }
/* 214 */           DownloadingService.a(DownloadingService.this, locala);
/*     */         } else {
/* 216 */           Toast.makeText(DownloadingService.b(DownloadingService.this), 
/* 217 */             com.umeng.common.a.c.a(DownloadingService.b(DownloadingService.this)), 
/* 218 */             0).show();
/* 219 */           localMessage = Message.obtain();
/* 220 */           localMessage.what = 2;
/* 221 */           localMessage.arg1 = 4;
/* 222 */           localMessage.arg2 = 0;
/*     */           try {
/* 224 */             paramMessage.replyTo.send(localMessage);
/*     */           } catch (RemoteException localRemoteException3) {
/* 226 */             localRemoteException3.printStackTrace();
/*     */           }
/*     */         }
/*     */ 
/*     */         break;
/*     */       default:
/* 232 */         super.handleMessage(paramMessage);
/*     */       }
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.common.net.DownloadingService
 * JD-Core Version:    0.6.2
 */